home *** CD-ROM | disk | FTP | other *** search
/ Cream of the Crop 1 / Cream of the Crop 1.iso / PROGRAM / ULARN.ARJ / ULARN.TAR / ularn / help.c < prev    next >
C/C++ Source or Header  |  1989-10-25  |  2KB  |  100 lines

  1. /*    help.c        */
  2. #include "header.h"
  3.  
  4. /*
  5.  *    help function to display the help info    
  6.  *
  7.  *    format of the .larn.help file
  8.  *
  9.  *    1st character of file:    # of pages of help available (ascii digit)
  10.  *    page (23 lines) for the introductory message (not counted in above)
  11.  *    pages of help text (23 lines per page)
  12.  */
  13. extern char helpfile[];
  14. help()
  15. {
  16.     register int i,j;
  17.     char tmbuf[128];    
  18.     /* intermediate translation buffer when not a VT100 */
  19.     if ((j=openhelp()) < 0)  
  20.         return;    /* open the help file and get # pages */
  21.  
  22.     for (i=0; i<23; i++) lgetl();    /* skip over intro message */
  23.     for (;  j>0; j--) {
  24.         clear();
  25.         for (i=0; i<23; i++) { 
  26.             tmcapcnv(tmbuf,lgetl());  
  27.             lprcat(tmbuf); 
  28.         } /* intercept \33's */
  29.         if (j>1) {
  30.             lprcat("    ---- Press ");  
  31.             standout("return");
  32.             lprcat(" to exit, ");  
  33.             standout("space");
  34.             lprcat(" for more help ---- ");
  35.             i=0; 
  36.             while ((i!=' ') && (i!='\n') && (i!='\33')) 
  37.                 i=getcharacter();
  38.             if ((i=='\n') || (i=='\33')) {
  39.                 lrclose();  
  40.                 setscroll();  
  41.                 drawscreen();  
  42.                 return;
  43.             }
  44.         }
  45.     }
  46.     lrclose();  
  47.     retcont();  
  48.     drawscreen();
  49. }
  50.  
  51. /*
  52.  *    function to display the welcome message and background
  53.  */
  54. welcome()
  55. {
  56.     register int i;
  57.     char tmbuf[128];/* intermediate translation buffer when not a VT100 */
  58.  
  59.     if (openhelp() < 0)  
  60.         return;       /* open the help file */
  61.     clear();
  62.     for(i=0; i<23; i++) { 
  63.         tmcapcnv(tmbuf,lgetl());  
  64.         lprcat(tmbuf); 
  65.     } /* intercept \33's */
  66.     lrclose();  
  67.     retcont();    /* press return to continue */
  68. }
  69.  
  70. /*
  71.  *    function to say press return to continue and reset scroll when done
  72.  */
  73. retcont()
  74. {
  75.     cursor(1,24); 
  76.     lprcat("Press "); 
  77.     standout("return");
  78.     lprcat(" to continue: ");   
  79.     while (getcharacter() != '\n')
  80.         ;
  81.     setscroll();
  82. }
  83.  
  84. /*
  85.  *    routine to open the help file and return the first character - '0'
  86.  */
  87. openhelp()
  88. {
  89.     if (lopen(helpfile)<0) {
  90.         lprintf("Can't open help file \"%s\" ",helpfile);
  91.         lflush(); 
  92.         sleep(4);    
  93.         drawscreen();    
  94.         setscroll(); 
  95.         return(-1);
  96.     }
  97.     resetscroll();  
  98.     return(lgetc() - '0');
  99. }
  100.